import java.util.Scanner;
public class text02{
	 public static void main(String[] args) {
		 int currentid=0;
		 Scanner in = new Scanner(System.in);
		 int n= in.nextInt();
		 Person []persons = new Person[n];  
		 for(int i=0;i<n;i++){
		  persons[i]= new Person(in.next(),in.nextInt(),in.nextBoolean());
		  persons[i].setId(currentid);
		  currentid++; 
		}	
		for(int i=n-1;i>=0;i--){
			 System.out.println(persons[i].toString());	
		}
		 Person person=new Person(); 
		 person.setId(currentid);
		 System.out.println(person.toString());	
	}
	}  
     class Person{
 		private String name;
 		private boolean gender;
 		private int age;
 		private int id;
 		private static int tempid;
 		{    	
 			id = Person.tempid;
 			System.out.printf("This is initialization block, id is %d%n",id);
 			Person.tempid++;
 		}
 		static {
 			System.out.println("This is static initializtion block");
 		}
 	    Person(){
 			System.out.println("This is constructor");
 			System.out.println(name + "," + age + "," + gender + "," + id);		 
 		}
 		 Person(String name,int age,boolean gender){
 			setName(name);
 			setAge(age);
 			setGender(gender);
 		} 
 		public String toString() {
 			return "Person [name=" + name + ", age=" + age + ", gender="
 					+ gender + ", id=" + id + "]";
 		}
 		public String getName() {
 			return name;
 		}
 		public void setName(String name) {
 			this.name = name;
 		}
 		public boolean isGender() {
 			return gender;
 		}
 		public void setGender(boolean gender) {
 			this.gender = gender;
 		}
 		public int getAge() {
 			return age;
 		}
 		public void setAge(int age) {
 			this.age = age;
 		}
 		public int getId() {
 			return id;
 		}
 		public void setId(int id) {
 			this.id = id;
 		}
}